package com.hui.platform.falseworkapi.service.base.oss.config;


import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.hui.platform.falseworkapi.service.base.oss.constant.AliyunOssProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * OSS配置
 * @author hui
 *
 */
@Configuration
@EnableConfigurationProperties(AliyunOssProperties.class)
public class OssConfiguration {

	@Autowired
	private AliyunOssProperties aliyunOssProperties;

	@Bean
	public OSS ossClient(){
		  OSS ossClient = new OSSClientBuilder()
				  .build(aliyunOssProperties.getEndpoint()
						  ,aliyunOssProperties.getAccessKeyId()
						  ,aliyunOssProperties.getAccessKeySecret());
		return ossClient;
	}
}
